let schedule_yh_service = {
    // 初始化影院列表
    created: function () {
        this.findScheduleAll(1, 10);
    },

    changeSearchCondition: function (condition) {
        this.searchCondition = condition;
        // 条件瘦素
        this.searchScheduleByMovieName(1, 10, this.keyword, this.searchCondition)
    },

    // 改变操作卡片
    changeOperateCard: function (card) {
        this.operateCard = card;
    },

    // 影片开始放映的时间
    scheduleStartTime: function () {
        // 单位价格
        var dateTime = this.schedule.date + " " + this.schedule.time;
        return dateTime
    },

    // 监听卡片的变化
    watchCard: function (newMode, oldMode) {
        var cinemaId = this.schedule.cinemaId;
        var movieId = this.schedule.movieId;
        if (newMode == 'add') {
            // 如果已经选中影院则不再初始化影片的下拉框
            if (cinemaId == "" || cinemaId == null) {
                // 初始化影片下拉框
                this.findMovieAll();
            }
            // 如果已经选中影片则不再初始化影院的下拉框
            if (movieId == "" || movieId == null) {
                // 初始化影院下拉框
                this.findCinemaAll();
            }
            // 初始化版本信息
            this.findVersionAll();
        }
    },

    // 监听影院的变化
    watchCinema: function (newMode, oldMode) {
        // 初始化联动的影厅信息
        this.findHallByCinemaId(newMode);
        var movieId = this.schedule.movieId;
        if (movieId == '' || movieId == null) {
            // 初始化联动的影片
            this.findMovieByCinema(newMode)
        }
        // 根据选中的影院处理当前计划的参考价格
        var proposedPrice = 0;
        for (i=0; i<this.cinemaList.length; i++) {
            if (this.cinemaList[i].cinemaId == newMode) {
                proposedPrice = this.cinemaList[i].startPurchasePrice;
            }
        }
        this.schedule.startPurchasePrice = proposedPrice;
    },

    // 监听影片的变化
    watchMovieId: function (newMode, oldMode) {
        var cinemaId = this.schedule.cinemaId;
        if (cinemaId == "" || cinemaId == null) {
            // 初始化联动的影院
            this.findCinemaByMovieId(newMode);
        }
    },

    // 分页功能 改变下拉框中每页的记录数时触发
    handleSizeChange: function (val) {
        if (this.keyword == '') {
            // 重新搜索
            this.findScheduleAll(this.page.pageNum, val, this.searchCondition);
        } else {
            // 条件瘦素
            this.searchScheduleByMovieName(this.page.pageNum, val, this.keyword, this.searchCondition)
        }
    },
    // 分页功能 点击导航按钮时触发
    handleCurrentChange: function (val) {
        if (this.keyword == '') {
            // 重新搜索
            this.findScheduleAll(val, this.page.pageSize, this.searchCondition);
        } else {
            // 条件瘦素
            this.searchScheduleByMovieName(val, this.page.pageSize, this.keyword, this.searchCondition)
        }
    },
}